package com.yaojiaxun.logisticsPlatformSystem.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: yjx_j
 * @Date: 2019/2/14 21:42
 * @Description:
 */
@Controller
public class MailController {
    @Autowired
    JavaMailSender jms;

    @ResponseBody
    @RequestMapping("/forgetPassword")
    public String send(@RequestParam("clientEmail") String clientEmail){
        //建立邮件消息
        SimpleMailMessage mainMessage = new SimpleMailMessage();
        //发送者
        mainMessage.setFrom("yjx_jason_wangyi@163.com");
        //接收者
        mainMessage.setTo(clientEmail);
        //发送的标题
        mainMessage.setSubject("密码重置");
        //发送的内容
        mainMessage.setText("hello world");
        jms.send(mainMessage);
        return "已将密码重置邮件发往您注册账号时的邮箱,请注意查收!";
    }
}
